﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Main.Master" Inherits="System.Web.Mvc.ViewPage<Defect_Tracking_System.Models.DefectListModel>" %>

<%@ Register src="DefectLists.ascx" tagname="DefectLists" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	SearchDefect
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="page-heading">
	<h1>Search Result</h1>
</div>
<!-- end page-heading -->

<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
	<th rowspan="3" class="sized"><img src="/Content/images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
	<th class="topleft"></th>
	<td id="tbl-border-top">&nbsp;</td>
	<th class="topright"></th>
	<th rowspan="3" class="sized"><img src="/Content/images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
	<td id="tbl-border-left"></td>
	<td>
	<!--  start content-table-inner ...................................................................... START -->
    
	    <div id="content-table-inner">
		<!--  start table-content  -->
		<div id="table-content">
        <form action="" name="formMain" method="post" >
            <uc1:DefectLists ID="DefectLists" runat="server" />
            <input type="hidden" id="KeyWord" name="KeyWord" value="<%: ViewData["KeyWord"] %>" />
        </form>
        </div>
        <!--  end content-table  -->
        <% if (Model.UserRole != "User")
            { %>
                <!--  start actions-box ............................................... -->
		        <div id="actions-box">
			        <a href="#" class="action-slider"></a>
			        <div id="actions-box-slider">
				        <a href="#" onclick="deleteDefect()" class="action-delete">Delete</a>
                        <a href="#" onclick="exportExcel()" class="action-delete">Export all</a>
			        </div>
			        <div class="clear"></div>
		        </div>
		        <!-- end actions-box........... -->
        <% } %>
		<!--  start paging..................................................... -->
		<table border="0" cellpadding="0" cellspacing="0" id="paging-table">
		<tr>
		<td>
            <div id="PageNavigator">
                <% if (Model.hasPrevious)
                   {%>
                        <a href="/Defect/SearchDefect/<%: ViewData["KeyWord"] %>/1" class="page-far-left"></a>
                        <a href="/Defect/SearchDefect/<%: ViewData["KeyWord"] %>/<%: Model.PageIndex - 1 %>" class="page-left"></a>
                <% } %>
                <div class="page-info">Page <strong><%: Model.PageIndex%></strong> / <%: Model.TotalPage%></div>
                <% if (Model.hasNext)
                   {%>
                        <a href="/Defect/SearchDefect/<%: ViewData["KeyWord"] %>/<%: Model.PageIndex + 1 %>" class="page-right"></a>
                        <a href="/Defect/SearchDefect/<%: ViewData["KeyWord"] %>/<%: Model.TotalPage %>" class="page-far-right"></a>
                 <%}%>
            </div>
		</td>
		</tr>
		</table>
		<!--  end paging................ -->
		<div class="clear"></div>
	</div>
	<!--  end content-table-inner ............................................END  -->
	</td>
	<td id="tbl-border-right"></td>
</tr>
<tr>
	<th class="sized bottomleft"></th>
	<td id="tbl-border-bottom">&nbsp;</td>
	<th class="sized bottomright"></th>
</tr>
</table>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="Fotter" runat="server">
<script type="text/javascript">
    function exportExcel() {
        //window.location = "/Defect/Export?type="+ $("#TypeView").val() +"&projectId=" + $("#ProjectId").val();
        document.formMain.action = "/Defect/Export"
        document.formMain.submit();
    }
    function deleteDefects() {
        if (confirm('Are you sure to delete these defects?')) {
            document.formMain.action = "/Defect/DeleteDefect"
            document.formMain.submit();
        }
    }
</script>
</asp:Content>
